import React from "react";
import "./index.css"
import { Table } from 'antd';
import 'antd/dist/antd.css';
// import ReactDOM from 'react-dom';


class list extends React.Component {
    state={
        columns:[          
            {
                title: '最新职位',
                dataIndex: 'name',
                render:text => <a href="###">{text}</a>,
            },  
            {
                title:"",
                dataIndex:"city",
                key:"city"

            },
            {
                title: '更多',
                dataIndex: 'msg',
                key: 'msg',
            },
        ],
        data:[{
            key: '1',
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "9分钟前"
        }, {
            key: '2',
            name: '阿里巴巴',
            city:"上海",
            msg: "9分钟前"
        }, {
            key: '3',
            name: '阿里',
            city:"杭州",
            msg: "9分钟前"
        }, {
            key: '4',
            name: '阿',
            city:"杭州",
            msg: "19分钟前"
        }, {
            key: '5',
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "29分钟前"
        },{
            key:"6",
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "39分钟前"
        },{
            key:"7",
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "49分钟前"
        },
        {
            key:"8",
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "9分钟前"
        },
        {
            key:"9",
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "9分钟前"},

        {
            key:"10",
            name: '阿里巴巴-同城零售',
            city:"杭州",
            msg: "9分钟前"
        }
    ]
    };
    componentDidMount(){
        var newList = document.querySelector(".tab1");
        var listLi = document.querySelector(".ant-table-tbody");
        var nowLIst = newList.offsetHeight;
       listLi.style.position = "absolute";
       listLi.style.top = "0";
       listLi.innerHTML += listLi.innerHTML;
         var timer = null;
         timer = setInterval(go, 100);
       function go(){
        var top = Math.abs(parseInt(listLi.style.top));
        if (top >= nowLIst) { 
            listLi.style.top = "0";
        } else {
            listLi.style.top = parseInt(listLi.style.top) - 2 + "px";
        }
       }  
     listLi.onmouseover = function () {
        clearInterval(timer);
    }
    listLi.onmouseout = function () {
        clearInterval(timer);
        timer = setInterval(go, 100);
    }

}
    render = () => {   
  return (<div className="widown">
            <Table columns={this.state.columns} dataSource={this.state.data} pagination={false} size={"middle"} className="tab1" />
        </div>
    )
}
}

export default list;
